﻿function MarkerManager(map) {
    this.map_ = map;
    this.markers_ = [];
}
MarkerManager.prototype.addMarker = function (id,latlng, options) {
    var marker = new LabelMarker(id,latlng, options, this.map_);
    this.markers_.push(marker);
    return marker;
}
MarkerManager.prototype.removeMarker = function (marker) {
    var index = jQuery.inArray(marker, this.markers_);
    if (index >= 0) {
        marker.remove();
        this.markers_.splice(index, 1);
    }
}
MarkerManager.prototype.clearMarkers = function () {
    jQuery(this.markers_).each(function (i, n) {
        n.remove(null);
    });
    this.markers_.splice(0, jQuery(this.markers_).size());
}
MarkerManager.prototype.findMarker = function (id) {
    var marker = null;
    $(this.markers_).each(function (i, n) {
        if (n.markerid == id) {
            marker = n;
            return false;
        }
    });
    return marker;
}